package three_PalindromeNumber;

public class CSolution {

    public static void main(String[] args) {
        System.out.println(isPalindrome(10));
        System.out.println(isPalindrome(-10));
        System.out.println(isPalindrome(1));
        System.out.println(isPalindrome(11));
        System.out.println(isPalindrome(131));

    }

    private static boolean isPalindrome(int x) {
        if(x<0) {
            return false;
        }
        char[] str = String.valueOf(x).toCharArray();
        int head = 0;
        int end = str.length-1;
        while(head<=end) {
            if(str[head] != str[end]) {
                return false;
            }
            head++;
            end--;
        }
        return true;
    }
}
